
public class Test {
    public static void main(String[] args) {
      final char[] value = {'a','b','c','d'};
      value[1] = 'x';//修改数组内容
      value = new char[10];//指向新的对象
    }
    public static void main15(String[] args) {
        String str = new String("0123456");
        String tmp = str.substring(2,5);//截取[2,5)
        System.out.println(tmp);
    }
    public static void main14(String[] args) {
        String str = new String("aa-bb cc");
        String[] tmp = str.split("-| ");//以-和空格拆分
        for(String s:tmp) {
            System.out.println(s);
        }
    }
    public static void main13(String[] args) {
      String str = new String("abc def ghi");
      String[] tmp = str.split(" ",2);//拆成两组
        for (String s:tmp) {
            System.out.println(s);
        }
    }
    public static void main12(String[] args) {
        String str = new String("aabbccdd");
       String tmp= str.replaceFirst("a","xx");
        System.out.println(tmp);
    }
    public static void main11(String[] args) {
        String str = new String("abcde");
        char[] arr = str.toCharArray();
        for (int i = 0; i < arr.length; i++) {
            System.out.print(arr[i]+" ");
        }
        System.out.println();
        char[] ch = {'a','b','c'};
        String s = new String(ch);
        System.out.println(s);

    }
    public static void main10(String[] args) {
      String str = new String("ABCD");
      String tmp = str.toLowerCase();
        System.out.println(tmp);
    }
    public static void main9(String[] args) {
        String str = new String("aabbccdd");
        System.out.println(str.indexOf("ab",2));
    }
    public static void main8(String[] args) {
        String str = new String("abcdefg");
        int index = str.charAt(3);
        System.out.println(index);
        System.out.println(str.charAt(0));
    }
    public static void main7(String[] args) {
        String str1 = new String("abcd");
        String str2 = new String("ABCC");
        System.out.println(str1.compareToIgnoreCase(str2));
    }

    public static void main6(String[] args) {
      String str1 = new String("abcd");
      String str2 = new String("abce");
      String str3 = new String("abc");
        System.out.println(str1.compareTo(str2));
        System.out.println(str1.compareTo(str3));

    }
    public static void main5(String[] args) {
        String str1 = new String("abcd");
        String str2 = new String("abcd");
        System.out.println(str1.equals(str2));
    }
    public static void main4(String[] args) {
        String str1 = "abcd";

        String str2 = new String("666");

        char[] arr = {'x'};
        String str3 = new String(arr);

        System.out.println(str1+" "+str2+" "+str3);


    }
    public static void main3(String[] args) {
        String[] arr = new String[10];
        char[] arr2 = {'a','b'};
        String str = new String(arr2);
        arr2 = new char[10];


    }
    public static void main2(String[] args) {
        String str = new String("abcdef");
        System.out.println(str);
        str = new String("xxxx");
        System.out.println(str);

        String ret = "xxxx";
        ret =new String("aaaa");
        System.out.println(ret);




    }
    public static void main1(String[] args) {
        char[] str = new char[] {'a','b','c'};
        for (int i = 0; i < str.length; i++) {
            System.out.print(str[i]+" ");
        }
        System.out.println();
        str[0] = 'x';
        for (int i = 0; i < str.length; i++) {
            System.out.print(str[i]+" ");
        }
        System.out.println();
        str = new char[10];
        for (int i = 0; i < str.length; i++) {
            System.out.println(str[i]+" ");
        }
    }
}